<?php
use app\models\Mall;
use yii\helpers\Url;

$web = Url::base();
$site_name = \app\models\Mall::getCurrentInstitutionSiteName();
$institution_code = Mall::getCurrentInstitutionCode();
$this->title = $site_name;
?>

<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <link href="<?= $web ?>/css/mall/global.css" rel="stylesheet" type="text/css">
    <link rel="stylesheet" type="text/css" href="<?= $web ?>/css/mall/login.css"/>

    <style>
        .footer .footxian {
            background: url(<?= $web ?>/images/mall/footxian.jpg);
        }

        .login .goods-img .dlk input.srsjhm {
            background: url(<?= $web ?>/images/mall/shurushoujihaoma.jpg) no-repeat;
        }

        .login .goods-img .dlk input.srmm {
            background: url(<?= $web ?>/images/mall/denglumima.jpg) no-repeat;

        }

        .login-left-img {
            margin-top: -48px;
        }
    </style>

    <script src="<?= $web ?>/js/jquery-1.10.2.min.js"></script>
    <script src="<?= $web ?>/js/tools.js"></script>
    <script type="text/javascript">
        $(function () {
            $('#btnSmsVerificationCode').click(function () {
                if ($(this).hasClass('hqyzm-disabled')) {
                    return;
                }

                $(this).addClass('hqyzm-disabled');
                $(this).val('正在获取...');
                var phone = $('#txtPhone').val().trim();
                if (phone.length == 0) {
                    alert('请输入手机号码');
                    $(this).val('获取验证码');
                    $(this).removeClass('hqyzm-disabled');
                    $('#txtPhone').focus();
                    return;
                }
                var that = this;
                requestJson('send-login-sms-verification-code-handler', {phone: phone}, true, function (responseData) {
                    if (responseData.status != 0) {
                        $(that).val('获取验证码');
                        $(that).removeClass('hqyzm-disabled');
                        alert(responseData.message);
                    } else {
                        verifyTimeoutValue = 60;
                        verifyTimeout();
                    }
                }, function () {
                    $(that).val('获取验证码');
                    $(that).removeClass('hqyzm-disabled');
                });
            });

            $('#txtPhone').focus();
        });

        var verifyTimeoutValue = 0;
        function verifyTimeout() {
            if (verifyTimeoutValue > 0) {
                $('#btnSmsVerificationCode').val('重新获取(' + verifyTimeoutValue + ')');
                verifyTimeoutValue--;
                setTimeout(verifyTimeout, 1000);
            } else {
                $('#btnSmsVerificationCode').val('获取验证码');
                $('#btnSmsVerificationCode').removeClass('hqyzm-disabled');
            }
        }
    </script>
    <title>登录</title>
</head>

<body>
<div class="head-top" style="background: #FFFFFF;">
    <div class="head-top-content">
        <div class="head-phone head-content-list">
            客户服务：400-860-3111
        </div>
        <a href="">
            <div class="head-shopping head-content-list">
                <div class="head-shopping-img"><img src="<?= $web ?>/images/mall/head-1.png"></div>
                <div>购物袋</div>
                <div class="head-shopping-number">0</div>
            </div>
        </a>
        <a href="">
            <div class="head-content-list head-order">
                我的订单
            </div>
        </a>
        <div class="head-land head-content-list">
            <a href="" style="color: #e1515b;">登录</a>&nbsp;
            <a href="" style="color: #333; display: none;">忘记密码?</a>
        </div>
    </div>
</div>
<!---->
<div class="login">
    <div class="integral">
        <p><span class="integral-title">欢迎登录<?= $site_name ?></span><span class="dlbd">/</span>尊敬的用户，欢迎您回来</p>
    </div>
    <div class="goods-img">
        <div class="login-left-img fl">
            <img src="<?= $web ?>/images/mall/login-left-img.png"/>
        </div>
        <div class="dlk fl">
            <form action="login?return_url=<?= $return_url ?>" method="post">
                <input type="text" class="srsjhm" name="phone" id="txtPhone" value="" placeholder="输入您的手机号码"/>
                <input type="text" class="srmm fl" name="verification_code" value="" placeholder="输入短信验证码"/>
                <input type="button" class="hqyzm fl" id="btnSmsVerificationCode" value="获取验证码"/>
                <input type="submit" class="dlkdl" value="登录"/>
            </form>
        </div>
    </div>
</div>

<div class="new-footer">
    <div class="foot-top-border"></div>
    <div class="footer-content">
        <div class="wechat">
            <div class="accounts">
                <img src="<?= $web ?>/images/mall/duolahe-weixin.jpg"/>
                <p>微信公众号</p>
                <p>扫码关注我们</p>
            </div>
            <div class="store">
                <?php $web_base = Url::base(true); ?>
                <img src="<?= Url::to(['mall-m/qr-code-out', 'text' => Url::to(['mall-m/index', 'institution_code' => $institution_code], true), 'margin' => 1, 'isCache' => true]) ?>"/>
                <p>手机商城</p>
                <p>兑换更方便</p>
            </div>
        </div>
        <div class="corporate-information">
            <p>全国服务热线：400-860-3111</p>
            <p>联系电话：131 4839 4117</p>
            <p>联系地址：重庆市江北区海尔路178号美全22世纪A座3楼</p>
            <p>重庆鑫泰科技有限责任公司版权所有 Copyright©2016 All Rights Reserved | 渝ICP备15012802号</p>
        </div>
    </div>
</div>
</body>

</html>
<!--<form action="login" method="post">-->
<!--    <input type="tel" id="txtPhone" name="phone" placeholder="输入手机号" value="13622222222">-->
<!--    <input type="text" value="123456" name="verification_code">-->
<!--    <button id="btnSend">发送验证码</button>-->
<!--    <button id="btnLogin" type="submit">登录</button>-->
<!--</form>-->
<?php ////var_dump($user_detail) ?>
<!---->
<!--<script type="application/javascript">-->
<!--    $(function () {-->
<!--        $('#btnSend').click(function () {-->
<!--            var phone = $('#txtPhone').val();-->
<!--            requestJson('send-sms-verification-code-handler', {'phone': phone}, true, function (responseData) {-->
<!--                if (responseData.status == 0) {-->
<!--                    alert('发送成功');-->
<!--                } else {-->
<!--                    alert(responseData.message);-->
<!--                }-->
<!--            });-->
<!--        });-->
<!--    });-->
<!--</script>-->